TPT API
The TPT API is used to remotely control TPT via other Java applications, see Java API, or TPT API scripts, see Python bindings. Unlike the Java API, Python bindings do not require a special development environment. Select Options|Preferences|General|TPT API) and select the Enable TPT API (RMI) checkbox and enter a RMI binding name and a Port, see General preferences - TPT API.
The easiest way to remotely control TPT is to use TPT API scripts. Select View|Show View|API Script Editor to open the editor. By using Python bindings you have access to all TPT project specifics, see Python bindings. You can test your script immediately in TPT. You can create or modify test cases, open or close TPT projects, or get some information about the specified signals in the Declaration Editor, see Figure "API Script Editor view". You can refer to other files with an absolute path. When using a relative path, keep in mind the parent directory of the TPT API file opened in the API Script Editor view is the working directory. Thus, the files relatively referred to must be saved in the same folder as the TPT API script.
Another possibility is offered by the Java API which requires a special development environment, see Java API.
The following buttons can be used in the editor:
|
create a new script (Ctrl+N). |
|
open a file (Ctrl+O); you can also drag an API script file onto the |
|
save the API script (Ctrl+S); click on the arrow to save the API script under another name as |
|
execute the API script (Ctrl+Enter); the output of the script is displayed in the lower part of the API Script Editor view. |
|
cancel API script execution |
|
The command line argument field can be used to pass arguments to the script for testing, which can be accessed in the script via sys.argv
.
In this editor, all methods and utilities of Python and the TPT API functions can be used. The editor supports the autocompletion feature (shortcut Ctrl+Space). To select an available TPT API function, type TPTAPI.
in the editor and press Ctrl+Space. The scripts can be executed either from the command line, type tpt.exe --run apiserver <apiRunScript>
, see API server plug-in, or from the API Script Editor view by clicking on Execute current script in the toolbar of the editor.
For more information about the TPT API documentation and which functions and constants are automatically imported, see Java API and Automatically imported classes.